/**
 * pharma-business - 27 févr. 2011
 * guillaume
 */
package org.bspv.pharma.business.rules;

/**
 * @author guillaume
 *
 */
public class AndSpecification<T> extends AbstractCompositeSpecification<T> {

    /**
     * Constructeur par défaut.
     * @param specifications
     */
    public AndSpecification(Specification<T>... specifications) {
        super(specifications);
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isSatisfiedBy(final T candidate) {
        boolean result = true;
 
        for (Specification<T> specification : this.specifications) {
            result &= specification.isSatisfiedBy(candidate);
        }
        return result;
    }
    
}
